<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>jQuery淡入淡出案列</title>
    <script src="../jquery/jquery.v3.7.1.js"></script>
    <style>
        *{margin: 0; padding: 0;}
        li{list-style: none;}
        img{border: none;vertical-align: middle;}
        .wrap{
            width: 80%;
            margin: 0 auto;
        }
        .box{
            width: 660px;
            margin: 0 auto;
            margin-top: 100px;
            background-color: black;
        }
        .box>ul{
            margin: 0;
            padding: 0;
            display: grid;
            grid-template-columns: auto auto auto;
            padding: 20px;
            grid-gap: 10px;
        }
        .box>ul>li{
            width: 200px;
            height: 200px;
        }
        .box>ul>li>img{
            width: 100%;
            height: 100%;
        }
    </style>
</head>
<body>
    <div class="wrap">
        <div class="box">
            <ul>
                <li><img src="../image/1.jpg" alt=""></li>
                <li><img src="../image/2.jpg" alt=""></li>
                <li><img src="../image/3.jpg" alt=""></li>
                <li><img src="../image/4.jpg" alt=""></li>
                <li><img src="../image/5.jpg" alt=""></li>
                <li><img src="../image/6.jpg" alt=""></li>
            </ul>
        </div>
    </div>
    <script>
        //鼠标进入的时候，其他的li标签透明度为 0.5
        //鼠标离开时，其他 li标签透明度改为 1
        $(function(){
            $('.box>ul>li').hover(function(){
                $(this).siblings().stop().fadeTo(0,0.5)
            },function(){
                $(this).siblings().stop().fadeTo(100,1)
            });
        })
</script>
</body>
</html>